package cc.atliberty.refresh;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/RefreshServlet")
public class RefreshServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        response.setDateHeader("expires", System.currentTimeMillis() + 1000 * 3600);
        response.setHeader("refresh", "3;url=/javaweb_exam/refresh/xuehao.html");
        response.getWriter().write("3秒后跳转");
    }
}
